<template>
  <view class="wrapper">
    <h5-login v-if="isH5" />
    <mp-weixin-login v-if="isMpWeixin" />
  </view>
</template>

<script>
import h5Login from './components/h5Login'
import mpWeixinLogin from './components/mpWeixinLogin'

export default {
  components: { h5Login, mpWeixinLogin },
  data() {
    return {
      redirect: null
    }
  },

  onLoad(options) {
    let redirect = options.redirect
    if (redirect) {
      redirect = decodeURIComponent(redirect)
      this.redirect = redirect
    }
  },
  onShow() {
    // this.checkLogined()
  },

  computed: {
    isH5() {
      let rst = false
      // #ifdef H5
      rst = true
      // #endif
      return rst
    },
    isMpWeixin() {
      let rst = false
      // #ifdef MP-WEIXIN
      rst = true
      // #endif
      return rst
    }
  },

  methods: {
    // checkLogined() {
    //   if (uni.getStorageSync('access_token')) {
    //     if (this.redirect) {
    //       uni.redirectTo({ url: this.redirect })
    //     } else {
    //       uni.navigateBack({ delta: 0 })
    //     }
    //   }
    // }
  }
}
</script>

<style lang="less" scoped></style>
